package com.mall.dto;

import com.mall.entity.PmsProduct;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
public class FrontIndexProductDto {
    @ApiModelProperty(value = "商品id")
    private Long id; // 商品id
    @ApiModelProperty(value = "商品名称")
    private String name; // 分类名称
    @ApiModelProperty(value = "商品图片")
    private String image; // 图片
    @ApiModelProperty(value = "商品价格")
    private String price; // 价格
    @ApiModelProperty(value = "商品分类名称")
    private String productCategoryName; // 商品分类名称
    @ApiModelProperty(value = "商品父级分类名称")
    private String productCategoryParentName; //父级分类名称

    public void setProduct(PmsProduct product) {
        this.id = product.getId();
        this.name = product.getName();
        this.image = product.getPic();
        this.price = product.getPrice().toString();
        this.productCategoryName = product.getProductCategoryName();
    }
}
